var db = require("../util/DataBase.js")

var blackUserService = {
  getBlockUserList(userId, success, error) {

    db.query("SELECT `block_user_id` FROM `block_user` WHERE `user_id` = ?", [userId], function (err, results) {
      if(err) {
        error();
        return;
      }

      success(results);

    });

  },
  isBlock(userId, blockUserId, success, error) {

    db.query("SELECT `id` FROM `block_user` WHERE `user_id` = ? AND `block_user_id` = ?", [userId, blockUserId], function (err, results) {
      if(err) {
        error();
        return;
      }

      success(results.length > 0 ? true : false);

    });

  },
  isReport(userId, reportUserId, success, error) {

    db.query("SELECT `id` FROM `report_user` WHERE `user_id` = ? AND `report_user_id` = ?", [userId, reportUserId], function (err, results) {
      if(err) {
        error();
        return;
      }

      success(results.length > 0 ? true : false);

    });

  }
}

module.exports = blackUserService;
